<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>WiFi Socket</title>
<title>CMSIS-Driver: WiFi Socket</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="cmsis.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<script type="text/javascript" src="printComponentTabs.js"></script>
<script type="text/javascript" src="cmsis_footer.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 46px;">
  <td id="projectlogo"><img alt="Logo" src="CMSIS_Logo_Final.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">CMSIS-Driver
   &#160;<span id="projectnumber">Version 2.8.0</span>
   </div>
   <div id="projectbrief">Peripheral Interface for Middleware and Application Code</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<div id="CMSISnav" class="tabs1">
    <ul class="tablist">
      <script type="text/javascript">
		<!--
		writeComponentTabs.call(this);
		//-->
      </script>
	  </ul>
</div>
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Usage&#160;and&#160;Description</span></a></li>
      <li><a href="modules.html"><span>Reference</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__wifi__socket__gr.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#groups">Content</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">WiFi Socket<div class="ingroups"><a class="el" href="group__wifi__interface__gr.html">WiFi Interface</a></div></div>  </div>
</div><!--header-->
<div class="contents">

<p>Socket interface to IP stack running on WiFi module.  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="groups"></a>
Content</h2></td></tr>
<tr class="memitem:group__wifi__addr__family"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wifi__addr__family.html">WiFi Socket Address Family definitions</a></td></tr>
<tr class="memdesc:group__wifi__addr__family"><td class="mdescLeft">&#160;</td><td class="mdescRight">WiFi Socket Address Family definitions. <br/></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__wifi__socket__type"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wifi__socket__type.html">WiFi Socket Type definitions</a></td></tr>
<tr class="memdesc:group__wifi__socket__type"><td class="mdescLeft">&#160;</td><td class="mdescRight">WiFi Socket Type definitions. <br/></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__wifi__protocol"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wifi__protocol.html">WiFi Socket Protocol definitions</a></td></tr>
<tr class="memdesc:group__wifi__protocol"><td class="mdescLeft">&#160;</td><td class="mdescRight">WiFi Socket Protocol definitions. <br/></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__wifi__soc__opt"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wifi__soc__opt.html">WiFi Socket Option definitions</a></td></tr>
<tr class="memdesc:group__wifi__soc__opt"><td class="mdescLeft">&#160;</td><td class="mdescRight">WiFi Socket Option definitions. <br/></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__wifi__soc__func"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wifi__soc__func.html">WiFi Socket Function return codes</a></td></tr>
<tr class="memdesc:group__wifi__soc__func"><td class="mdescLeft">&#160;</td><td class="mdescRight">WiFi Socket Function return codes. <br/></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga1433b297315ab394f1544a18548ffcc6"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wifi__socket__gr.html#ga1433b297315ab394f1544a18548ffcc6">ARM_WIFI_SocketCreate</a> (int32_t af, int32_t type, int32_t protocol)</td></tr>
<tr class="memdesc:ga1433b297315ab394f1544a18548ffcc6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a communication socket.  <a href="#ga1433b297315ab394f1544a18548ffcc6">More...</a><br/></td></tr>
<tr class="separator:ga1433b297315ab394f1544a18548ffcc6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gae69f7822b658765f1cd3f74e9a50c246"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wifi__socket__gr.html#gae69f7822b658765f1cd3f74e9a50c246">ARM_WIFI_SocketBind</a> (int32_t socket, const uint8_t *ip, uint32_t ip_len, uint16_t port)</td></tr>
<tr class="memdesc:gae69f7822b658765f1cd3f74e9a50c246"><td class="mdescLeft">&#160;</td><td class="mdescRight">Assign a local address to a socket.  <a href="#gae69f7822b658765f1cd3f74e9a50c246">More...</a><br/></td></tr>
<tr class="separator:gae69f7822b658765f1cd3f74e9a50c246"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga4929aab257781dcaae7197f917991779"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wifi__socket__gr.html#ga4929aab257781dcaae7197f917991779">ARM_WIFI_SocketListen</a> (int32_t socket, int32_t backlog)</td></tr>
<tr class="memdesc:ga4929aab257781dcaae7197f917991779"><td class="mdescLeft">&#160;</td><td class="mdescRight">Listen for socket connections.  <a href="#ga4929aab257781dcaae7197f917991779">More...</a><br/></td></tr>
<tr class="separator:ga4929aab257781dcaae7197f917991779"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga24e6a015e519373c3f108cc5aa764ef8"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wifi__socket__gr.html#ga24e6a015e519373c3f108cc5aa764ef8">ARM_WIFI_SocketAccept</a> (int32_t socket, uint8_t *ip, uint32_t *ip_len, uint16_t *port)</td></tr>
<tr class="memdesc:ga24e6a015e519373c3f108cc5aa764ef8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Accept a new connection on a socket.  <a href="#ga24e6a015e519373c3f108cc5aa764ef8">More...</a><br/></td></tr>
<tr class="separator:ga24e6a015e519373c3f108cc5aa764ef8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac0f189afbd35914d4c85e77b40672b16"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wifi__socket__gr.html#gac0f189afbd35914d4c85e77b40672b16">ARM_WIFI_SocketConnect</a> (int32_t socket, const uint8_t *ip, uint32_t ip_len, uint16_t port)</td></tr>
<tr class="memdesc:gac0f189afbd35914d4c85e77b40672b16"><td class="mdescLeft">&#160;</td><td class="mdescRight">Connect a socket to a remote host.  <a href="#gac0f189afbd35914d4c85e77b40672b16">More...</a><br/></td></tr>
<tr class="separator:gac0f189afbd35914d4c85e77b40672b16"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaecc9ba19491ed00c27da3f5677895d48"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wifi__socket__gr.html#gaecc9ba19491ed00c27da3f5677895d48">ARM_WIFI_SocketRecv</a> (int32_t socket, void *buf, uint32_t len)</td></tr>
<tr class="memdesc:gaecc9ba19491ed00c27da3f5677895d48"><td class="mdescLeft">&#160;</td><td class="mdescRight">Receive data or check if data is available on a connected socket.  <a href="#gaecc9ba19491ed00c27da3f5677895d48">More...</a><br/></td></tr>
<tr class="separator:gaecc9ba19491ed00c27da3f5677895d48"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga2b15232d69f2ae8e189512d6c68c8a81"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wifi__socket__gr.html#ga2b15232d69f2ae8e189512d6c68c8a81">ARM_WIFI_SocketRecvFrom</a> (int32_t socket, void *buf, uint32_t len, uint8_t *ip, uint32_t *ip_len, uint16_t *port)</td></tr>
<tr class="memdesc:ga2b15232d69f2ae8e189512d6c68c8a81"><td class="mdescLeft">&#160;</td><td class="mdescRight">Receive data or check if data is available on a socket.  <a href="#ga2b15232d69f2ae8e189512d6c68c8a81">More...</a><br/></td></tr>
<tr class="separator:ga2b15232d69f2ae8e189512d6c68c8a81"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaee8615b026e8525fb21ca45ba3778ac8"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wifi__socket__gr.html#gaee8615b026e8525fb21ca45ba3778ac8">ARM_WIFI_SocketSend</a> (int32_t socket, const void *buf, uint32_t len)</td></tr>
<tr class="memdesc:gaee8615b026e8525fb21ca45ba3778ac8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Send data or check if data can be sent on a connected socket.  <a href="#gaee8615b026e8525fb21ca45ba3778ac8">More...</a><br/></td></tr>
<tr class="separator:gaee8615b026e8525fb21ca45ba3778ac8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga5ddd3dd5f863b8392e4281dd48a28d28"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wifi__socket__gr.html#ga5ddd3dd5f863b8392e4281dd48a28d28">ARM_WIFI_SocketSendTo</a> (int32_t socket, const void *buf, uint32_t len, const uint8_t *ip, uint32_t ip_len, uint16_t port)</td></tr>
<tr class="memdesc:ga5ddd3dd5f863b8392e4281dd48a28d28"><td class="mdescLeft">&#160;</td><td class="mdescRight">Send data or check if data can be sent on a socket.  <a href="#ga5ddd3dd5f863b8392e4281dd48a28d28">More...</a><br/></td></tr>
<tr class="separator:ga5ddd3dd5f863b8392e4281dd48a28d28"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac187e418893de33817e4fcbdd85dbaee"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wifi__socket__gr.html#gac187e418893de33817e4fcbdd85dbaee">ARM_WIFI_SocketGetSockName</a> (int32_t socket, uint8_t *ip, uint32_t *ip_len, uint16_t *port)</td></tr>
<tr class="memdesc:gac187e418893de33817e4fcbdd85dbaee"><td class="mdescLeft">&#160;</td><td class="mdescRight">Retrieve local IP address and port of a socket.  <a href="#gac187e418893de33817e4fcbdd85dbaee">More...</a><br/></td></tr>
<tr class="separator:gac187e418893de33817e4fcbdd85dbaee"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa484a931d55d163477920bc865dd9220"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wifi__socket__gr.html#gaa484a931d55d163477920bc865dd9220">ARM_WIFI_SocketGetPeerName</a> (int32_t socket, uint8_t *ip, uint32_t *ip_len, uint16_t *port)</td></tr>
<tr class="memdesc:gaa484a931d55d163477920bc865dd9220"><td class="mdescLeft">&#160;</td><td class="mdescRight">Retrieve remote IP address and port of a socket.  <a href="#gaa484a931d55d163477920bc865dd9220">More...</a><br/></td></tr>
<tr class="separator:gaa484a931d55d163477920bc865dd9220"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga6d69360e9774937b7bdc03b45fbc9075"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wifi__socket__gr.html#ga6d69360e9774937b7bdc03b45fbc9075">ARM_WIFI_SocketGetOpt</a> (int32_t socket, int32_t opt_id, void *opt_val, uint32_t *opt_len)</td></tr>
<tr class="memdesc:ga6d69360e9774937b7bdc03b45fbc9075"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get socket option.  <a href="#ga6d69360e9774937b7bdc03b45fbc9075">More...</a><br/></td></tr>
<tr class="separator:ga6d69360e9774937b7bdc03b45fbc9075"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga5de80d6729d9504a21dd5d31dc504017"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wifi__socket__gr.html#ga5de80d6729d9504a21dd5d31dc504017">ARM_WIFI_SocketSetOpt</a> (int32_t socket, int32_t opt_id, const void *opt_val, uint32_t opt_len)</td></tr>
<tr class="memdesc:ga5de80d6729d9504a21dd5d31dc504017"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set socket option.  <a href="#ga5de80d6729d9504a21dd5d31dc504017">More...</a><br/></td></tr>
<tr class="separator:ga5de80d6729d9504a21dd5d31dc504017"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga391464de71b6a5d300fda9434fe87a87"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wifi__socket__gr.html#ga391464de71b6a5d300fda9434fe87a87">ARM_WIFI_SocketClose</a> (int32_t socket)</td></tr>
<tr class="memdesc:ga391464de71b6a5d300fda9434fe87a87"><td class="mdescLeft">&#160;</td><td class="mdescRight">Close and release a socket.  <a href="#ga391464de71b6a5d300fda9434fe87a87">More...</a><br/></td></tr>
<tr class="separator:ga391464de71b6a5d300fda9434fe87a87"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga0c37435c6abc68ee0f1f4357b503e0bf"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wifi__socket__gr.html#ga0c37435c6abc68ee0f1f4357b503e0bf">ARM_WIFI_SocketGetHostByName</a> (const char *name, int32_t af, uint8_t *ip, uint32_t *ip_len)</td></tr>
<tr class="memdesc:ga0c37435c6abc68ee0f1f4357b503e0bf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Retrieve host IP address from host name.  <a href="#ga0c37435c6abc68ee0f1f4357b503e0bf">More...</a><br/></td></tr>
<tr class="separator:ga0c37435c6abc68ee0f1f4357b503e0bf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac7a8abb9e23f3f52dabce4153a53c1ca"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wifi__socket__gr.html#gac7a8abb9e23f3f52dabce4153a53c1ca">ARM_WIFI_Ping</a> (const uint8_t *ip, uint32_t ip_len)</td></tr>
<tr class="memdesc:gac7a8abb9e23f3f52dabce4153a53c1ca"><td class="mdescLeft">&#160;</td><td class="mdescRight">Probe remote host with Ping command.  <a href="#gac7a8abb9e23f3f52dabce4153a53c1ca">More...</a><br/></td></tr>
<tr class="separator:gac7a8abb9e23f3f52dabce4153a53c1ca"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Description</h2>
<p>Socket interface to IP stack running on WiFi module. </p>
<p>The <a class="el" href="group__wifi__socket__gr.html">WiFi Socket</a> functions provide the interface to an IP stack that is running on the WiFi module. This IP stack handles data communication with the network and provides the user with a communication endpoint called sockets. </p>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="ga1433b297315ab394f1544a18548ffcc6"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t ARM_WIFI_SocketCreate </td>
          <td>(</td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>af</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>type</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>protocol</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Create a communication socket. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">af</td><td>Address family </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">type</td><td>Socket type </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">protocol</td><td>Socket protocol </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>status information<ul>
<li>Socket identification number (&gt;=0)</li>
<li><a class="el" href="group__wifi__soc__func.html#ga695aa5c5329602d9465fbc6c22fc9978">ARM_SOCKET_EINVAL</a> : Invalid argument</li>
<li><a class="el" href="group__wifi__soc__func.html#ga95ab80319bfbc5413fc5334e3d5ce5d2">ARM_SOCKET_ENOTSUP</a> : Operation not supported</li>
<li><a class="el" href="group__wifi__soc__func.html#ga68e88e80822f779361407d005659fc6c">ARM_SOCKET_ENOMEM</a> : Not enough memory</li>
<li><a class="el" href="group__wifi__soc__func.html#ga2f3db9fdae2366238054ff8a8e8ef97c">ARM_SOCKET_ERROR</a> : Unspecified error</li>
</ul>
</dd></dl>
<p>The function <b>ARM_WIFI_SocketCreate</b> creates a communication endpoint called a socket.</p>
<p>The argument <em>af</em> specifies the address family. The following values are supported: </p>
<table class="doxtable">
<tr>
<th align="left">Family </th><th align="left">Description  </th></tr>
<tr>
<td align="left"><a class="el" href="group__wifi__addr__family.html#ga1a17023d92374b4f2d963aa7ac1c4e17">ARM_SOCKET_AF_INET</a> </td><td align="left">Address Family Internet </td></tr>
<tr>
<td align="left"><a class="el" href="group__wifi__addr__family.html#gad50c95421ffbc6eec5f8458b2e170c26">ARM_SOCKET_AF_INET6</a> </td><td align="left">Address Family Internet version 6 </td></tr>
</table>
<p>The argument <em>type</em> specifies the communication semantics. The following are the currently supported types: </p>
<table class="doxtable">
<tr>
<th align="left">Type </th><th align="left">Description  </th></tr>
<tr>
<td align="left"><a class="el" href="group__wifi__socket__type.html#ga9567d5735856190b2ae9cc39f68637f1">ARM_SOCKET_SOCK_STREAM</a> </td><td align="left">Provides a reliable connection based data stream that is full-duplex </td></tr>
<tr>
<td align="left"><a class="el" href="group__wifi__socket__type.html#gaced5f33eda2fc38a8303cd11a0d76fab">ARM_SOCKET_SOCK_DGRAM</a> </td><td align="left">Provides connectionless communication that is unreliable </td></tr>
</table>
<p>The argument <em>protocol</em> specifies the protocol that must be used with the socket type: </p>
<table class="doxtable">
<tr>
<th align="left">Protocol </th><th align="left">Description  </th></tr>
<tr>
<td align="left"><a class="el" href="group__wifi__protocol.html#gaf07cfcf1b65ea6c6be0629459a2ba781">ARM_SOCKET_IPPROTO_TCP</a> </td><td align="left">Must be used with ARM_SOCKET_SOCK_STREAM socket type </td></tr>
<tr>
<td align="left"><a class="el" href="group__wifi__protocol.html#gabacbead83c772f5737b25b4fc390e16d">ARM_SOCKET_IPPROTO_UDP</a> </td><td align="left">Must be used with ARM_SOCKET_SOCK_DGRAM socket type </td></tr>
<tr>
<td align="left"><span class="XML-Token">0</span> </td><td align="left">The system selects a matching protocol for the socket type </td></tr>
</table>
<p><b>Example:</b> </p>
<ul>
<li>see <a class="el" href="group__wifi__socket__gr.html#ga4929aab257781dcaae7197f917991779">ARM_WIFI_SocketListen</a>, <a class="el" href="group__wifi__socket__gr.html#gac0f189afbd35914d4c85e77b40672b16">ARM_WIFI_SocketConnect</a> </li>
</ul>

</div>
</div>
<a class="anchor" id="gae69f7822b658765f1cd3f74e9a50c246"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t ARM_WIFI_SocketBind </td>
          <td>(</td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>socket</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>ip</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>ip_len</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>port</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Assign a local address to a socket. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">socket</td><td>Socket identification number </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">ip</td><td>Pointer to local IP address </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">ip_len</td><td>Length of 'ip' address in bytes </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">port</td><td>Local port number </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>status information<ul>
<li>0 : Operation successful</li>
<li><a class="el" href="group__wifi__soc__func.html#ga535e069b83aafcf70dd089e6097bceef">ARM_SOCKET_ESOCK</a> : Invalid socket</li>
<li><a class="el" href="group__wifi__soc__func.html#ga695aa5c5329602d9465fbc6c22fc9978">ARM_SOCKET_EINVAL</a> : Invalid argument (address or socket already bound)</li>
<li><a class="el" href="group__wifi__soc__func.html#ga4fa475e41c3db0ada798249696e745a1">ARM_SOCKET_EADDRINUSE</a> : Address already in use</li>
<li><a class="el" href="group__wifi__soc__func.html#ga2f3db9fdae2366238054ff8a8e8ef97c">ARM_SOCKET_ERROR</a> : Unspecified error</li>
</ul>
</dd></dl>
<p>The function <b>ARM_WIFI_SocketBind</b> assigns a name to an unnamed socket. The name represents the local address and port of the communication endpoint.</p>
<p>The argument <em>socket</em> specifies a socket identification number returned from a previous call to <a class="el" href="group__wifi__socket__gr.html#ga1433b297315ab394f1544a18548ffcc6">ARM_WIFI_SocketCreate</a>.</p>
<p>The argument <em>ip</em> is a pointer to the buffer containing the IP address octets of the local IP address.</p>
<p>The argument <em>ip_len</em> specifies the length of the local IP address. The length is <span class="XML-Token">4</span> bytes for the IPv4 address and <span class="XML-Token">16</span> bytes for the IPv6 address.</p>
<p>The argument <em>port</em> specifies the local port. If the argument <em>port</em> is <span class="XML-Token">0</span>, the function returns error, because this port is reserved.</p>
<p><b>Example:</b> </p>
<ul>
<li>see <a class="el" href="group__wifi__socket__gr.html#ga4929aab257781dcaae7197f917991779">ARM_WIFI_SocketListen</a> </li>
</ul>

</div>
</div>
<a class="anchor" id="ga4929aab257781dcaae7197f917991779"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t ARM_WIFI_SocketListen </td>
          <td>(</td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>socket</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>backlog</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Listen for socket connections. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">socket</td><td>Socket identification number </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">backlog</td><td>Number of connection requests that can be queued </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>status information<ul>
<li>0 : Operation successful</li>
<li><a class="el" href="group__wifi__soc__func.html#ga535e069b83aafcf70dd089e6097bceef">ARM_SOCKET_ESOCK</a> : Invalid socket</li>
<li><a class="el" href="group__wifi__soc__func.html#ga695aa5c5329602d9465fbc6c22fc9978">ARM_SOCKET_EINVAL</a> : Invalid argument (socket not bound)</li>
<li><a class="el" href="group__wifi__soc__func.html#ga95ab80319bfbc5413fc5334e3d5ce5d2">ARM_SOCKET_ENOTSUP</a> : Operation not supported</li>
<li><a class="el" href="group__wifi__soc__func.html#gaa1e456c6cea2f6579158818387557f1a">ARM_SOCKET_EISCONN</a> : Socket is already connected</li>
<li><a class="el" href="group__wifi__soc__func.html#ga2f3db9fdae2366238054ff8a8e8ef97c">ARM_SOCKET_ERROR</a> : Unspecified error</li>
</ul>
</dd></dl>
<p>The function <b>ARM_WIFI_SocketListen</b> sets the specified socket to listening mode, that is to the server mode of operation. Before calling the <b>ARM_WIFI_SocketListen</b> function, the <a class="el" href="group__wifi__socket__gr.html#gae69f7822b658765f1cd3f74e9a50c246">ARM_WIFI_SocketBind</a> function must be called.</p>
<p>The argument <em>socket</em> specifies a socket identification number returned from a previous call to <a class="el" href="group__wifi__socket__gr.html#ga1433b297315ab394f1544a18548ffcc6">ARM_WIFI_SocketCreate</a>.</p>
<p>The argument <em>backlog</em> specifies a maximum number of connection requests that can be queued.</p>
<p><b>Example:</b> </p>
<div class="fragment"><div class="line"><span class="keyword">extern</span> <a class="code" href="group__wifi__interface__gr.html#structARM__DRIVER__WIFI">ARM_DRIVER_WIFI</a> Driver_WiFi0;</div>
<div class="line"><span class="keyword">static</span> <a class="code" href="group__wifi__interface__gr.html#structARM__DRIVER__WIFI">ARM_DRIVER_WIFI</a> *wifi;</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> Echo_Server_Thread (<span class="keywordtype">void</span> *arg) {</div>
<div class="line">  uint8_t ip[4] = { 0U, 0U, 0U, 0U };</div>
<div class="line">  int32_t sock, sd, res;</div>
<div class="line">  <span class="keywordtype">char</span> dbuf[120];</div>
<div class="line"> </div>
<div class="line">  <span class="keywordflow">while</span> (1) {</div>
<div class="line">    wifi = &amp;Driver_WiFi0;</div>
<div class="line">    sock = wifi-&gt;<a class="code" href="group__wifi__interface__gr.html#aa26f0cefe99161484741977a5443e92c">SocketCreate</a> (<a class="code" href="group__wifi__addr__family.html#ga1a17023d92374b4f2d963aa7ac1c4e17">ARM_SOCKET_AF_INET</a>, <a class="code" href="group__wifi__socket__type.html#ga9567d5735856190b2ae9cc39f68637f1">ARM_SOCKET_SOCK_STREAM</a>, <a class="code" href="group__wifi__protocol.html#gaf07cfcf1b65ea6c6be0629459a2ba781">ARM_SOCKET_IPPROTO_TCP</a>);</div>
<div class="line"> </div>
<div class="line">    wifi-&gt;<a class="code" href="group__wifi__interface__gr.html#afcbc0c2bb3639584521ffeaaffc5a475">SocketBind</a> (sock, (uint8_t *)ip, <span class="keyword">sizeof</span>(ip), 7U);</div>
<div class="line">    wifi-&gt;<a class="code" href="group__wifi__interface__gr.html#a628706c754e1793ec864453a5b517d5c">SocketListen</a> (sock, 1);</div>
<div class="line">    sd = wifi-&gt;<a class="code" href="group__wifi__interface__gr.html#a66bb43c1e713efe7758b6e100c13ed69">SocketAccept</a> (sock, NULL, NULL, NULL);</div>
<div class="line">    wifi-&gt;<a class="code" href="group__wifi__interface__gr.html#a471a1be6d9adbccb83ca1f268643031c">SocketClose</a> (sock);</div>
<div class="line">    sock = sd;</div>
<div class="line"> </div>
<div class="line">    <span class="keywordflow">while</span> (1) {</div>
<div class="line">      res = wifi-&gt;<a class="code" href="group__wifi__interface__gr.html#aaad6683992e76e3dd9a16eb6b7d43cf4">SocketRecv</a> (sock, dbuf, <span class="keyword">sizeof</span>(dbuf));</div>
<div class="line">      <span class="keywordflow">if</span> (res &lt; 0) {</div>
<div class="line">        <span class="keywordflow">break</span>;                                      <span class="comment">// Error occurred</span></div>
<div class="line">      }</div>
<div class="line">      <span class="keywordflow">if</span> (res &gt; 0) {</div>
<div class="line">        wifi-&gt;<a class="code" href="group__wifi__interface__gr.html#a7ff47d391831d547d310dd66f22c2942">SocketSend</a> (sock, dbuf, res);         <span class="comment">// Echo the data</span></div>
<div class="line">      }</div>
<div class="line">    }</div>
<div class="line">    wifi-&gt;<a class="code" href="group__wifi__interface__gr.html#a471a1be6d9adbccb83ca1f268643031c">SocketClose</a> (sock);</div>
<div class="line">  }</div>
<div class="line">}</div>
</div><!-- fragment --> 
</div>
</div>
<a class="anchor" id="ga24e6a015e519373c3f108cc5aa764ef8"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t ARM_WIFI_SocketAccept </td>
          <td>(</td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>socket</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>ip</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t *&#160;</td>
          <td class="paramname"><em>ip_len</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t *&#160;</td>
          <td class="paramname"><em>port</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Accept a new connection on a socket. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">socket</td><td>Socket identification number </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">ip</td><td>Pointer to buffer where address of connecting socket shall be returned (NULL for none) </td></tr>
    <tr><td class="paramdir">[in,out]</td><td class="paramname">ip_len</td><td>Pointer to length of 'ip' (or NULL if 'ip' is NULL)<ul>
<li>length of supplied 'ip' on input</li>
<li>length of stored 'ip' on output </li>
</ul>
</td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">port</td><td>Pointer to buffer where port of connecting socket shall be returned (NULL for none) </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>status information<ul>
<li>socket identification number of accepted socket (&gt;=0)</li>
<li><a class="el" href="group__wifi__soc__func.html#ga535e069b83aafcf70dd089e6097bceef">ARM_SOCKET_ESOCK</a> : Invalid socket</li>
<li><a class="el" href="group__wifi__soc__func.html#ga695aa5c5329602d9465fbc6c22fc9978">ARM_SOCKET_EINVAL</a> : Invalid argument (socket not in listen mode)</li>
<li><a class="el" href="group__wifi__soc__func.html#ga95ab80319bfbc5413fc5334e3d5ce5d2">ARM_SOCKET_ENOTSUP</a> : Operation not supported (socket type does not support accepting connections)</li>
<li><a class="el" href="group__wifi__soc__func.html#ga87fa238861921ba1b272019a83b04676">ARM_SOCKET_ECONNRESET</a> : Connection reset by the peer</li>
<li><a class="el" href="group__wifi__soc__func.html#ga7e64d6bd00a2f6e30ece3ff0f02b5b27">ARM_SOCKET_ECONNABORTED</a> : Connection aborted locally</li>
<li><a class="el" href="group__wifi__soc__func.html#ga699dbd55e543fd38d333cf1d4470d8db">ARM_SOCKET_EAGAIN</a> : Operation would block or timed out (may be called again)</li>
<li><a class="el" href="group__wifi__soc__func.html#ga2f3db9fdae2366238054ff8a8e8ef97c">ARM_SOCKET_ERROR</a> : Unspecified error</li>
</ul>
</dd></dl>
<p>The function <b>ARM_WIFI_SocketAccept</b> accepts a connection request queued for a listening socket. If a connection request is pending, <b>ARM_WIFI_SocketAccept</b> removes the request from the queue, and creates a new socket for the connection. The original listening socket remains open and continues to queue new connection requests. The <em>socket</em> must be a socket of type <b>ARM_SOCKET_SOCK_STREAM</b>.</p>
<p>In blocking mode, which is enabled by default, this function waits for a connection request. In non blocking mode, you must call the <b>ARM_WIFI_SocketAccept</b> function again if the error code <code>ARM_SOCKET_EAGAIN</code> is returned.</p>
<p>The argument <em>socket</em> specifies a socket identification number returned from a previous call to <a class="el" href="group__wifi__socket__gr.html#ga1433b297315ab394f1544a18548ffcc6">ARM_WIFI_SocketCreate</a>.</p>
<p>The argument <em>ip</em> is a pointer to the buffer that will receive the IP address of the connection node. If the <em>ip</em> is <span class="XML-Token">NULL</span>, the IP address is not returned.</p>
<p>The argument <em>ip_len</em> is a pointer to the IP address length. It should initially contain the amount of space pointed to by <em>ip</em>. On return it contains the actual length of the address returned in bytes.</p>
<p>The argument <em>port</em> is a pointer to the buffer, that will receive the port number of the connection node. If the <em>port</em> is <span class="XML-Token">NULL</span>, the port number is not returned.</p>
<p><b>Example:</b> </p>
<ul>
<li>see <a class="el" href="group__wifi__socket__gr.html#ga4929aab257781dcaae7197f917991779">ARM_WIFI_SocketListen</a> </li>
</ul>

</div>
</div>
<a class="anchor" id="gac0f189afbd35914d4c85e77b40672b16"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t ARM_WIFI_SocketConnect </td>
          <td>(</td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>socket</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>ip</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>ip_len</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>port</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Connect a socket to a remote host. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">socket</td><td>Socket identification number </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">ip</td><td>Pointer to remote IP address </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">ip_len</td><td>Length of 'ip' address in bytes </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">port</td><td>Remote port number </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>status information<ul>
<li>0 : Operation successful</li>
<li><a class="el" href="group__wifi__soc__func.html#ga535e069b83aafcf70dd089e6097bceef">ARM_SOCKET_ESOCK</a> : Invalid socket</li>
<li><a class="el" href="group__wifi__soc__func.html#ga695aa5c5329602d9465fbc6c22fc9978">ARM_SOCKET_EINVAL</a> : Invalid argument</li>
<li><a class="el" href="group__wifi__soc__func.html#ga9df0d5bd422102d9d4ebddc869d358e0">ARM_SOCKET_EALREADY</a> : Connection already in progress</li>
<li><a class="el" href="group__wifi__soc__func.html#gad7f3e077f7721a202012378ddcefb83f">ARM_SOCKET_EINPROGRESS</a> : Operation in progress</li>
<li><a class="el" href="group__wifi__soc__func.html#gaa1e456c6cea2f6579158818387557f1a">ARM_SOCKET_EISCONN</a> : Socket is connected</li>
<li><a class="el" href="group__wifi__soc__func.html#gaaf535c9d325172ff8ef02964af218cb0">ARM_SOCKET_ECONNREFUSED</a> : Connection rejected by the peer</li>
<li><a class="el" href="group__wifi__soc__func.html#ga7e64d6bd00a2f6e30ece3ff0f02b5b27">ARM_SOCKET_ECONNABORTED</a> : Connection aborted locally</li>
<li><a class="el" href="group__wifi__soc__func.html#ga4fa475e41c3db0ada798249696e745a1">ARM_SOCKET_EADDRINUSE</a> : Address already in use</li>
<li><a class="el" href="group__wifi__soc__func.html#ga320ffeeb44d583c0216b24d6e1009d9f">ARM_SOCKET_ETIMEDOUT</a> : Operation timed out</li>
<li><a class="el" href="group__wifi__soc__func.html#ga2f3db9fdae2366238054ff8a8e8ef97c">ARM_SOCKET_ERROR</a> : Unspecified error</li>
</ul>
</dd></dl>
<p>The function <b>ARM_WIFI_SocketConnect</b> assigns the address of the peer communication endpoint. The function behaves differently according to the type of socket:</p>
<ul>
<li><p class="startli"><b>ARM_SOCKET_SOCK_STREAM:</b> A connection is established between the endpoints.</p>
<p class="startli">In blocking mode, which is enabled by default, this function waits for a connection to be established.</p>
<p class="startli">In non blocking mode, the function returns the error code <code>ARM_SOCKET_EINPROGRESS</code> and the connection is established asynchronously. Subsequent calls to <b>ARM_WIFI_SocketConnect</b> for the same socket, before the connection is established, return the error code <code>ARM_SOCKET_EALREADY</code>. When the connection is established, the call to <b>ARM_WIFI_SocketConnect</b> returns the error code <code>ARM_SOCKET_EISCONN</code>.</p>
</li>
<li><p class="startli"><b>ARM_SOCKET_SOCK_DGRAM:</b> An address filter is established between the endpoints.</p>
<p class="startli">The address filter is changed with another <b>ARM_WIFI_SocketConnect</b> function call. If the socket is not yet bound, the system implicitly binds to a random dynamic port.</p>
</li>
</ul>
<p>The argument <em>socket</em> specifies a socket identification number returned from a previous call to <a class="el" href="group__wifi__socket__gr.html#ga1433b297315ab394f1544a18548ffcc6">ARM_WIFI_SocketCreate</a>.</p>
<p>The argument <em>ip</em> is a pointer to the buffer containing the IP address octets of the endpoint node.</p>
<p>The argument <em>ip_len</em> specifies the length of the IP address. The length is <span class="XML-Token">4</span> bytes for the IPv4 address and <span class="XML-Token">16</span> bytes for the IPv6 address.</p>
<p>The argument <em>port</em> specifies the port of the endpoint node. If the argument <em>port</em> is <span class="XML-Token">0</span>, the function returns error, because this port is reserved.</p>
<p><b>Example:</b> </p>
<div class="fragment"><div class="line"><span class="keyword">extern</span> <a class="code" href="group__wifi__interface__gr.html#structARM__DRIVER__WIFI">ARM_DRIVER_WIFI</a> Driver_WiFi0;</div>
<div class="line"><span class="keyword">static</span> <a class="code" href="group__wifi__interface__gr.html#structARM__DRIVER__WIFI">ARM_DRIVER_WIFI</a> *wifi;</div>
<div class="line"> </div>
<div class="line"><span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> message[] = { <span class="stringliteral">&quot;The quick brown fox jumps over the lazy dog.&quot;</span> };</div>
<div class="line">  </div>
<div class="line"><span class="keywordtype">void</span> Echo_Client_Thread (<span class="keywordtype">void</span> *arg) {</div>
<div class="line">  uint8_t ip[4] = { 192U, 168U, 0U, 100U };</div>
<div class="line">  int32_t sock, res;</div>
<div class="line">  <span class="keywordtype">char</span> dbuf[120];</div>
<div class="line"> </div>
<div class="line">  <span class="keywordflow">while</span> (1) {</div>
<div class="line">    wifi = &amp;Driver_WiFi0;</div>
<div class="line">    sock = wifi-&gt;<a class="code" href="group__wifi__interface__gr.html#aa26f0cefe99161484741977a5443e92c">SocketCreate</a> (<a class="code" href="group__wifi__addr__family.html#ga1a17023d92374b4f2d963aa7ac1c4e17">ARM_SOCKET_AF_INET</a>, <a class="code" href="group__wifi__socket__type.html#ga9567d5735856190b2ae9cc39f68637f1">ARM_SOCKET_SOCK_STREAM</a>, <a class="code" href="group__wifi__protocol.html#gaf07cfcf1b65ea6c6be0629459a2ba781">ARM_SOCKET_IPPROTO_TCP</a>);</div>
<div class="line"> </div>
<div class="line">    res = wifi-&gt;<a class="code" href="group__wifi__interface__gr.html#a45cbca28d9866f2ec2ad9df830787dd7">SocketConnect</a> (sock, (uint8_t *)ip, <span class="keyword">sizeof</span>(ip), 7U);</div>
<div class="line">    <span class="keywordflow">if</span> (res == 0) {</div>
<div class="line">      wifi-&gt;<a class="code" href="group__wifi__interface__gr.html#a7ff47d391831d547d310dd66f22c2942">SocketSend</a> (sock, message, <span class="keyword">sizeof</span>(message));</div>
<div class="line">      res = wifi-&gt;<a class="code" href="group__wifi__interface__gr.html#aaad6683992e76e3dd9a16eb6b7d43cf4">SocketRecv</a> (sock, dbuf, <span class="keyword">sizeof</span>(dbuf));</div>
<div class="line">      <span class="keywordflow">if</span> (res &lt; 0) {</div>
<div class="line">        <span class="keywordflow">break</span>;               <span class="comment">// Error occured</span></div>
<div class="line">      }</div>
<div class="line">      <span class="keywordflow">if</span> (res &gt; 0) {</div>
<div class="line">        <span class="keywordflow">if</span> (memcmp (dbuf, message, res) != 0) {</div>
<div class="line">          <span class="comment">// error handling, message is not the same as sent</span></div>
<div class="line">        }</div>
<div class="line">      }    </div>
<div class="line">    }</div>
<div class="line">    wifi-&gt;<a class="code" href="group__wifi__interface__gr.html#a471a1be6d9adbccb83ca1f268643031c">SocketClose</a> (sock);</div>
<div class="line">    osDelay (1000U);</div>
<div class="line">  }</div>
<div class="line">}</div>
</div><!-- fragment --> 
</div>
</div>
<a class="anchor" id="gaecc9ba19491ed00c27da3f5677895d48"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t ARM_WIFI_SocketRecv </td>
          <td>(</td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>socket</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>len</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Receive data or check if data is available on a connected socket. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">socket</td><td>Socket identification number </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">buf</td><td>Pointer to buffer where data should be stored </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">len</td><td>Length of buffer (in bytes), set len = 0 to check if data is available </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>status information<ul>
<li>number of bytes received (&gt;=0), if len != 0</li>
<li>0 : Data is available (len = 0)</li>
<li><a class="el" href="group__wifi__soc__func.html#ga535e069b83aafcf70dd089e6097bceef">ARM_SOCKET_ESOCK</a> : Invalid socket</li>
<li><a class="el" href="group__wifi__soc__func.html#ga695aa5c5329602d9465fbc6c22fc9978">ARM_SOCKET_EINVAL</a> : Invalid argument (pointer to buffer or length)</li>
<li><a class="el" href="group__wifi__soc__func.html#ga0bde95e313d907032074583bc06b24a1">ARM_SOCKET_ENOTCONN</a> : Socket is not connected</li>
<li><a class="el" href="group__wifi__soc__func.html#ga87fa238861921ba1b272019a83b04676">ARM_SOCKET_ECONNRESET</a> : Connection reset by the peer</li>
<li><a class="el" href="group__wifi__soc__func.html#ga7e64d6bd00a2f6e30ece3ff0f02b5b27">ARM_SOCKET_ECONNABORTED</a> : Connection aborted locally</li>
<li><a class="el" href="group__wifi__soc__func.html#ga699dbd55e543fd38d333cf1d4470d8db">ARM_SOCKET_EAGAIN</a> : Operation would block or timed out (may be called again)</li>
<li><a class="el" href="group__wifi__soc__func.html#ga2f3db9fdae2366238054ff8a8e8ef97c">ARM_SOCKET_ERROR</a> : Unspecified error</li>
</ul>
</dd></dl>
<p>The function <b>ARM_WIFI_SocketRecv</b> receives incoming data that has been queued for the socket. You can use this function with both, the stream and the datagram socket. It reads as much information as currently available up to the size of the buffer specified.</p>
<p>In blocking mode, which is enabled by default, this function waits for received data. In non blocking mode, you must call the <b>ARM_WIFI_SocketRecv</b> function again if the error code <code>ARM_SOCKET_EAGAIN</code> is returned.</p>
<p>The argument <em>socket</em> specifies a socket identification number returned from a previous call to <a class="el" href="group__wifi__socket__gr.html#ga1433b297315ab394f1544a18548ffcc6">ARM_WIFI_SocketCreate</a>.</p>
<p>The argument <em>buf</em> is a pointer to the application data buffer for storing the data to. If the available data is too large to fit in the supplied application buffer <em>buf</em>, excess bytes are discarded in case of a datagram sockets. For stream sockets, the data is buffered internally so the application can retrieve all data by multiple calls of <b>ARM_WIFI_SocketRecv</b> function.</p>
<p>The argument <em>len</em> specifies the size of the application data buffer.</p>
<dl class="section note"><dt>Note</dt><dd>The function can also be used to check if the socket has data available to read by specifying <span class="XML-Token">0</span> for argument <em>len</em> (argument <em>buf</em> is ignored). The function returns <span class="XML-Token">0</span> if data is available or error code otherwise. In blocking mode, the function waits until data is available, in non blocking mode the function returns instantly.</dd></dl>
<p><b>Example:</b> </p>
<ul>
<li>see <a class="el" href="group__wifi__socket__gr.html#ga4929aab257781dcaae7197f917991779">ARM_WIFI_SocketListen</a> </li>
</ul>

</div>
</div>
<a class="anchor" id="ga2b15232d69f2ae8e189512d6c68c8a81"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t ARM_WIFI_SocketRecvFrom </td>
          <td>(</td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>socket</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>len</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>ip</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t *&#160;</td>
          <td class="paramname"><em>ip_len</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t *&#160;</td>
          <td class="paramname"><em>port</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Receive data or check if data is available on a socket. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">socket</td><td>Socket identification number </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">buf</td><td>Pointer to buffer where data should be stored </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">len</td><td>Length of buffer (in bytes), set len = 0 to check if data is available </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">ip</td><td>Pointer to buffer where remote source address shall be returned (NULL for none) </td></tr>
    <tr><td class="paramdir">[in,out]</td><td class="paramname">ip_len</td><td>Pointer to length of 'ip' (or NULL if 'ip' is NULL)<ul>
<li>length of supplied 'ip' on input</li>
<li>length of stored 'ip' on output </li>
</ul>
</td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">port</td><td>Pointer to buffer where remote source port shall be returned (NULL for none) </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>status information<ul>
<li>number of bytes received (&gt;=0), if len != 0</li>
<li>0 : Data is available (len = 0)</li>
<li><a class="el" href="group__wifi__soc__func.html#ga535e069b83aafcf70dd089e6097bceef">ARM_SOCKET_ESOCK</a> : Invalid socket</li>
<li><a class="el" href="group__wifi__soc__func.html#ga695aa5c5329602d9465fbc6c22fc9978">ARM_SOCKET_EINVAL</a> : Invalid argument (pointer to buffer or length)</li>
<li><a class="el" href="group__wifi__soc__func.html#ga0bde95e313d907032074583bc06b24a1">ARM_SOCKET_ENOTCONN</a> : Socket is not connected</li>
<li><a class="el" href="group__wifi__soc__func.html#ga87fa238861921ba1b272019a83b04676">ARM_SOCKET_ECONNRESET</a> : Connection reset by the peer</li>
<li><a class="el" href="group__wifi__soc__func.html#ga7e64d6bd00a2f6e30ece3ff0f02b5b27">ARM_SOCKET_ECONNABORTED</a> : Connection aborted locally</li>
<li><a class="el" href="group__wifi__soc__func.html#ga699dbd55e543fd38d333cf1d4470d8db">ARM_SOCKET_EAGAIN</a> : Operation would block or timed out (may be called again)</li>
<li><a class="el" href="group__wifi__soc__func.html#ga2f3db9fdae2366238054ff8a8e8ef97c">ARM_SOCKET_ERROR</a> : Unspecified error</li>
</ul>
</dd></dl>
<p>The function <b>ARM_WIFI_SocketRecvFrom</b> is used to receive data that has been queued for a socket. It is normally used to receive messages on datagram sockets, but can also be used to receive a reliable, ordered stream of data on a connected stream sockets. It reads as much information as currently available up to the size of the buffer specified.</p>
<p>In blocking mode, which is enabled by default, this function waits for received data. In non blocking mode, you must call the <b>ARM_WIFI_SocketRecv</b> function again if the error code <code>ARM_SOCKET_EAGAIN</code> is returned.</p>
<p>The argument <em>socket</em> specifies a socket identification number returned from a previous call to <a class="el" href="group__wifi__socket__gr.html#ga1433b297315ab394f1544a18548ffcc6">ARM_WIFI_SocketCreate</a>.</p>
<p>The argument <em>buf</em> is a pointer to the application data buffer for storing the data to. If the available data is too large to fit in the supplied application buffer <em>buf</em>, excess bytes are discarded in case of a datagram sockets. For stream sockets, the data is buffered internally so the application can retrieve all data by multiple calls of <b>ARM_WIFI_SocketRecv</b> function.</p>
<p>The argument <em>len</em> specifies the size of the application data buffer.</p>
<p>The argument <em>ip</em> is a pointer to the buffer that will receive the IP address of the sender. If the <em>ip</em> is <span class="XML-Token">NULL</span>, the IP address is not returned.</p>
<p>The argument <em>ip_len</em> is a pointer to the IP address length. It should initially contain the amount of space pointed to by <em>ip</em>. On return it contains the actual length of the address returned in bytes.</p>
<p>The argument <em>port</em> is a pointer to the buffer, that will receive the port number of the sender. If the <em>port</em> is <span class="XML-Token">NULL</span>, the port number is not returned.</p>
<dl class="section note"><dt>Note</dt><dd>The function can also be used to check if the socket has data available to read by specifying <span class="XML-Token">0</span> for argument <em>len</em> (arguments <em>buf</em>, <em>ip</em>, <em>ip_len</em> and <em>port</em> are ignored). The function returns <span class="XML-Token">0</span> if data is available or error code otherwise. In blocking mode, the function waits until data is available, in non blocking mode the function returns instantly.</dd></dl>
<p><b>Example:</b> </p>
<div class="fragment"><div class="line"><span class="keyword">extern</span> <a class="code" href="group__wifi__interface__gr.html#structARM__DRIVER__WIFI">ARM_DRIVER_WIFI</a> Driver_WiFi0;</div>
<div class="line"><span class="keyword">static</span> <a class="code" href="group__wifi__interface__gr.html#structARM__DRIVER__WIFI">ARM_DRIVER_WIFI</a> *wifi;</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> Echo_Server_Thread (<span class="keywordtype">void</span> *arg) {</div>
<div class="line">  uint8_t ip[4];</div>
<div class="line">  uint16_t port;</div>
<div class="line">  int32_t sock, res;</div>
<div class="line">  uint32_t ip_len;</div>
<div class="line">  <span class="keywordtype">char</span> dbuf[120];</div>
<div class="line"> </div>
<div class="line">  <span class="keywordflow">while</span> (1) {</div>
<div class="line">    wifi = &amp;Driver_WiFi0;</div>
<div class="line">    sock = wifi-&gt;<a class="code" href="group__wifi__interface__gr.html#aa26f0cefe99161484741977a5443e92c">SocketCreate</a> (<a class="code" href="group__wifi__addr__family.html#ga1a17023d92374b4f2d963aa7ac1c4e17">ARM_SOCKET_AF_INET</a>, <a class="code" href="group__wifi__socket__type.html#gaced5f33eda2fc38a8303cd11a0d76fab">ARM_SOCKET_SOCK_DGRAM</a>, <a class="code" href="group__wifi__protocol.html#gabacbead83c772f5737b25b4fc390e16d">ARM_SOCKET_IPPROTO_UDP</a>);</div>
<div class="line"> </div>
<div class="line">    ip[0] = 0U;                 <span class="comment">// Unspecified address</span></div>
<div class="line">    ip[1] = 0U;</div>
<div class="line">    ip[2] = 0U;</div>
<div class="line">    ip[3] = 0U;</div>
<div class="line">    port  = 7U;                 <span class="comment">// Standard port for Echo service</span></div>
<div class="line"> </div>
<div class="line">    wifi-&gt;<a class="code" href="group__wifi__interface__gr.html#afcbc0c2bb3639584521ffeaaffc5a475">SocketBind</a> (sock, (uint8_t *)ip, <span class="keyword">sizeof</span>(ip), port);</div>
<div class="line"> </div>
<div class="line">    <span class="keywordflow">while</span> (1) {</div>
<div class="line">      ip_len = <span class="keyword">sizeof</span>(ip);</div>
<div class="line">      res = wifi-&gt;<a class="code" href="group__wifi__interface__gr.html#a4343cf48bbcfb2101a422d90c34f84e6">SocketRecvFrom</a> (sock, dbuf, <span class="keyword">sizeof</span>(dbuf), (uint8_t *)ip, &amp;ip_len, &amp;port);</div>
<div class="line">      <span class="keywordflow">if</span> (res &lt; 0) {</div>
<div class="line">        <span class="keywordflow">break</span>;                  <span class="comment">// Error occurred</span></div>
<div class="line">      }</div>
<div class="line">      <span class="keywordflow">if</span> (res &gt; 0) {            <span class="comment">// Echo the data</span></div>
<div class="line">        wifi-&gt;<a class="code" href="group__wifi__interface__gr.html#a248a293faea6f6e1cb781b8153e468fa">SocketSendTo</a> (sock, dbuf, res, (uint8_t *)ip, ip_len, port);</div>
<div class="line">      }    </div>
<div class="line">    }</div>
<div class="line">    wifi-&gt;<a class="code" href="group__wifi__interface__gr.html#a471a1be6d9adbccb83ca1f268643031c">SocketClose</a> (sock);</div>
<div class="line">  }</div>
<div class="line">}</div>
</div><!-- fragment --> 
</div>
</div>
<a class="anchor" id="gaee8615b026e8525fb21ca45ba3778ac8"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t ARM_WIFI_SocketSend </td>
          <td>(</td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>socket</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const void *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>len</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Send data or check if data can be sent on a connected socket. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">socket</td><td>Socket identification number </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">buf</td><td>Pointer to buffer containing data to send </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">len</td><td>Length of data (in bytes), set len = 0 to check if data can be sent </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>status information<ul>
<li>number of bytes sent (&gt;=0), if len != 0</li>
<li>0 : Data can be sent (len = 0)</li>
<li><a class="el" href="group__wifi__soc__func.html#ga535e069b83aafcf70dd089e6097bceef">ARM_SOCKET_ESOCK</a> : Invalid socket</li>
<li><a class="el" href="group__wifi__soc__func.html#ga695aa5c5329602d9465fbc6c22fc9978">ARM_SOCKET_EINVAL</a> : Invalid argument (pointer to buffer or length)</li>
<li><a class="el" href="group__wifi__soc__func.html#ga0bde95e313d907032074583bc06b24a1">ARM_SOCKET_ENOTCONN</a> : Socket is not connected</li>
<li><a class="el" href="group__wifi__soc__func.html#ga87fa238861921ba1b272019a83b04676">ARM_SOCKET_ECONNRESET</a> : Connection reset by the peer</li>
<li><a class="el" href="group__wifi__soc__func.html#ga7e64d6bd00a2f6e30ece3ff0f02b5b27">ARM_SOCKET_ECONNABORTED</a> : Connection aborted locally</li>
<li><a class="el" href="group__wifi__soc__func.html#ga699dbd55e543fd38d333cf1d4470d8db">ARM_SOCKET_EAGAIN</a> : Operation would block or timed out (may be called again)</li>
<li><a class="el" href="group__wifi__soc__func.html#ga2f3db9fdae2366238054ff8a8e8ef97c">ARM_SOCKET_ERROR</a> : Unspecified error</li>
</ul>
</dd></dl>
<p>The function <b>ARM_WIFI_SocketSend</b> is used to send data on an already connected socket. This function is normally used to send a reliable, ordered stream of data bytes on a stream sockets. It can also be used to send messages on datagram sockets.</p>
<p>The argument <em>socket</em> specifies a socket identification number returned from a previous call to <a class="el" href="group__wifi__socket__gr.html#ga1433b297315ab394f1544a18548ffcc6">ARM_WIFI_SocketCreate</a>.</p>
<p>The argument <em>buf</em> is a pointer to the application data buffer containing data to transmit. The buffer data length is not limited in size. If the data length is too large for one packet, the <b>ARM_WIFI_SocketSend</b> function will fragment the data and send it in several successive data packets:</p>
<ul>
<li>In blocking mode, which is enabled by default, this function returns after the data has been successfully queued for transmission.</li>
<li>In non blocking mode, the function returns immediately without blocking the system.</li>
</ul>
<p>The argument <em>len</em> specifies the length of data in bytes.</p>
<p>Return value, when positive, represents the number of bytes sent, which can be less than <em>len</em>.</p>
<dl class="section note"><dt>Note</dt><dd>The function can also be used to check if the socket is ready to send data by specifying <span class="XML-Token">0</span> for argument <em>len</em> (argument <em>buf</em> is ignored). The function returns <span class="XML-Token">0</span> if the socket is writable or error code otherwise.</dd></dl>
<p><b>Example:</b> </p>
<ul>
<li>see <a class="el" href="group__wifi__socket__gr.html#ga4929aab257781dcaae7197f917991779">ARM_WIFI_SocketListen</a> </li>
</ul>

</div>
</div>
<a class="anchor" id="ga5ddd3dd5f863b8392e4281dd48a28d28"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t ARM_WIFI_SocketSendTo </td>
          <td>(</td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>socket</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const void *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>len</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>ip</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>ip_len</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>port</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Send data or check if data can be sent on a socket. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">socket</td><td>Socket identification number </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">buf</td><td>Pointer to buffer containing data to send </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">len</td><td>Length of data (in bytes), set len = 0 to check if data can be sent </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">ip</td><td>Pointer to remote destination IP address </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">ip_len</td><td>Length of 'ip' address in bytes </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">port</td><td>Remote destination port number </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>status information<ul>
<li>number of bytes sent (&gt;=0), if len != 0</li>
<li>0 : Data can be sent (len = 0)</li>
<li><a class="el" href="group__wifi__soc__func.html#ga535e069b83aafcf70dd089e6097bceef">ARM_SOCKET_ESOCK</a> : Invalid socket</li>
<li><a class="el" href="group__wifi__soc__func.html#ga695aa5c5329602d9465fbc6c22fc9978">ARM_SOCKET_EINVAL</a> : Invalid argument (pointer to buffer or length)</li>
<li><a class="el" href="group__wifi__soc__func.html#ga0bde95e313d907032074583bc06b24a1">ARM_SOCKET_ENOTCONN</a> : Socket is not connected</li>
<li><a class="el" href="group__wifi__soc__func.html#ga87fa238861921ba1b272019a83b04676">ARM_SOCKET_ECONNRESET</a> : Connection reset by the peer</li>
<li><a class="el" href="group__wifi__soc__func.html#ga7e64d6bd00a2f6e30ece3ff0f02b5b27">ARM_SOCKET_ECONNABORTED</a> : Connection aborted locally</li>
<li><a class="el" href="group__wifi__soc__func.html#ga699dbd55e543fd38d333cf1d4470d8db">ARM_SOCKET_EAGAIN</a> : Operation would block or timed out (may be called again)</li>
<li><a class="el" href="group__wifi__soc__func.html#ga2f3db9fdae2366238054ff8a8e8ef97c">ARM_SOCKET_ERROR</a> : Unspecified error</li>
</ul>
</dd></dl>
<p>The function <b>ARM_WIFI_SocketSendTo</b> is used to send data. It is normally used to send messages on a datagram sockets, but can also be used to send data on a connected stream sockets.</p>
<p>If the datagram socket is not yet bound, the system implicitly binds to a random dynamic port.</p>
<p>The argument <em>socket</em> specifies a socket identification number returned from a previous call to <a class="el" href="group__wifi__socket__gr.html#ga1433b297315ab394f1544a18548ffcc6">ARM_WIFI_SocketCreate</a>.</p>
<p>The argument <em>buf</em> is a pointer to the application data buffer containing data to transmit. The buffer data length is not limited in size. If the data length is too large for one packet, the <b>ARM_WIFI_SocketSend</b> function will fragment the data and send it in several successive data packets:</p>
<ul>
<li>In blocking mode, which is enabled by default, this function returns after the data has been successfully queued for transmission.</li>
<li>In non blocking mode, the function returns immediately without blocking the system.</li>
</ul>
<p>The argument <em>len</em> specifies the length of data in bytes.</p>
<p>The argument <em>ip</em> is a pointer to the buffer containing the IP address octets of the endpoint node.</p>
<p>The argument <em>ip_len</em> specifies the length of the IP address. The length is <span class="XML-Token">4</span> bytes for the IPv4 address and <span class="XML-Token">16</span> bytes for the IPv6 address.</p>
<p>The argument <em>port</em> specifies the port of the endpoint node. If the argument <em>port</em> is <span class="XML-Token">0</span>, the function returns error, because this port is reserved.</p>
<p>For the stream sockets, arguments <em>ip</em>, <em>ip_len</em> and <em>port</em> are ignored.</p>
<p>Return value, when positive, represents the number of bytes sent, which can be less than <em>len</em>.</p>
<dl class="section note"><dt>Note</dt><dd>The function can also be used to check if the socket is ready to send data by specifying <span class="XML-Token">0</span> for argument <em>len</em> (arguments <em>buf</em>, <em>ip</em>, <em>ip_len</em> and <em>port</em> are ignored). The function returns <span class="XML-Token">0</span> if the socket is writable or error code otherwise.</dd></dl>
<p><b>Example:</b> </p>
<ul>
<li>see <a class="el" href="group__wifi__socket__gr.html#ga2b15232d69f2ae8e189512d6c68c8a81">ARM_WIFI_SocketRecvFrom</a> </li>
</ul>

</div>
</div>
<a class="anchor" id="gac187e418893de33817e4fcbdd85dbaee"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t ARM_WIFI_SocketGetSockName </td>
          <td>(</td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>socket</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>ip</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t *&#160;</td>
          <td class="paramname"><em>ip_len</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t *&#160;</td>
          <td class="paramname"><em>port</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Retrieve local IP address and port of a socket. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">socket</td><td>Socket identification number </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">ip</td><td>Pointer to buffer where local address shall be returned (NULL for none) </td></tr>
    <tr><td class="paramdir">[in,out]</td><td class="paramname">ip_len</td><td>Pointer to length of 'ip' (or NULL if 'ip' is NULL)<ul>
<li>length of supplied 'ip' on input</li>
<li>length of stored 'ip' on output </li>
</ul>
</td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">port</td><td>Pointer to buffer where local port shall be returned (NULL for none) </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>status information<ul>
<li>0 : Operation successful</li>
<li><a class="el" href="group__wifi__soc__func.html#ga535e069b83aafcf70dd089e6097bceef">ARM_SOCKET_ESOCK</a> : Invalid socket</li>
<li><a class="el" href="group__wifi__soc__func.html#ga695aa5c5329602d9465fbc6c22fc9978">ARM_SOCKET_EINVAL</a> : Invalid argument (pointer to buffer or length)</li>
<li><a class="el" href="group__wifi__soc__func.html#ga2f3db9fdae2366238054ff8a8e8ef97c">ARM_SOCKET_ERROR</a> : Unspecified error</li>
</ul>
</dd></dl>
<p>The function <b>ARM_WIFI_SocketGetSockName</b> retrieves the local IP address and port for a socket.</p>
<p>The argument <em>socket</em> specifies a socket identification number returned from a previous call to <a class="el" href="group__wifi__socket__gr.html#ga1433b297315ab394f1544a18548ffcc6">ARM_WIFI_SocketCreate</a>.</p>
<p>The argument <em>ip</em> is a pointer to the buffer that will receive the local IP address. If the <em>ip</em> is <span class="XML-Token">NULL</span>, the local IP address is not returned.</p>
<p>The argument <em>ip_len</em> is a pointer to the IP address length. It should initially contain the amount of space pointed to by <em>ip</em>. On return it contains the actual length of the address returned in bytes.</p>
<p>The argument <em>port</em> is a pointer to the buffer, that will receive the local port number. If the <em>port</em> is <span class="XML-Token">NULL</span>, the local port number is not returned.</p>
<p><b>Example:</b> </p>
<div class="fragment"><div class="line"><span class="keyword">static</span> uint8_t  local_ip[4];    <span class="comment">// Socket address and port</span></div>
<div class="line"><span class="keyword">static</span> uint16_t local_port;</div>
<div class="line"> </div>
<div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> get_socket_local_info (<span class="keywordtype">void</span>) {</div>
<div class="line">  uint32_t ip_len;</div>
<div class="line"> </div>
<div class="line">  ip_len = <span class="keyword">sizeof</span>(local_ip);</div>
<div class="line">  wifi-&gt;<a class="code" href="group__wifi__interface__gr.html#ab7c3e0211c87bf99e9c42b17a2249f50">SocketGetSockName</a> (sock, (uint8_t *)local_ip, &amp;ip_len, &amp;local_port);</div>
<div class="line">}</div>
</div><!-- fragment --> 
</div>
</div>
<a class="anchor" id="gaa484a931d55d163477920bc865dd9220"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t ARM_WIFI_SocketGetPeerName </td>
          <td>(</td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>socket</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>ip</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t *&#160;</td>
          <td class="paramname"><em>ip_len</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t *&#160;</td>
          <td class="paramname"><em>port</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Retrieve remote IP address and port of a socket. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">socket</td><td>Socket identification number </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">ip</td><td>Pointer to buffer where remote address shall be returned (NULL for none) </td></tr>
    <tr><td class="paramdir">[in,out]</td><td class="paramname">ip_len</td><td>Pointer to length of 'ip' (or NULL if 'ip' is NULL)<ul>
<li>length of supplied 'ip' on input</li>
<li>length of stored 'ip' on output </li>
</ul>
</td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">port</td><td>Pointer to buffer where remote port shall be returned (NULL for none) </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>status information<ul>
<li>0 : Operation successful</li>
<li><a class="el" href="group__wifi__soc__func.html#ga535e069b83aafcf70dd089e6097bceef">ARM_SOCKET_ESOCK</a> : Invalid socket</li>
<li><a class="el" href="group__wifi__soc__func.html#ga695aa5c5329602d9465fbc6c22fc9978">ARM_SOCKET_EINVAL</a> : Invalid argument (pointer to buffer or length)</li>
<li><a class="el" href="group__wifi__soc__func.html#ga0bde95e313d907032074583bc06b24a1">ARM_SOCKET_ENOTCONN</a> : Socket is not connected</li>
<li><a class="el" href="group__wifi__soc__func.html#ga2f3db9fdae2366238054ff8a8e8ef97c">ARM_SOCKET_ERROR</a> : Unspecified error</li>
</ul>
</dd></dl>
<p>The function <b>ARM_WIFI_SocketGetPeerName</b> retrieves the IP address and port of the peer to which a socket is connected.</p>
<p>The argument <em>socket</em> specifies a socket identification number returned from a previous call to <a class="el" href="group__wifi__socket__gr.html#ga1433b297315ab394f1544a18548ffcc6">ARM_WIFI_SocketCreate</a>.</p>
<p>The argument <em>ip</em> is a pointer to the buffer that will receive the IP address of the peer. If the <em>ip</em> is <span class="XML-Token">NULL</span>, the IP address is not returned.</p>
<p>The argument <em>ip_len</em> is a pointer to the IP address length. It should initially contain the amount of space pointed to by <em>ip</em>. On return it contains the actual length of the address returned in bytes.</p>
<p>The argument <em>port</em> is a pointer to the buffer, that will receive the port number of the peer. If the <em>port</em> is <span class="XML-Token">NULL</span>, the port number is not returned.</p>
<p><b>Example:</b> </p>
<div class="fragment"><div class="line"><span class="keyword">static</span> uint8_t  peer_ip[4];    <span class="comment">// Socket address and port</span></div>
<div class="line"><span class="keyword">static</span> uint16_t peer_port;</div>
<div class="line"> </div>
<div class="line"><span class="keyword">static</span> <span class="keywordtype">void</span> get_socket_peer_info (<span class="keywordtype">void</span>) {</div>
<div class="line">  uint32_t ip_len;</div>
<div class="line"> </div>
<div class="line">  ip_len = <span class="keyword">sizeof</span>(peer_ip);</div>
<div class="line">  wifi-&gt;<a class="code" href="group__wifi__interface__gr.html#ac45fbc58fd00742cbe712bf26d857359">SocketGetPeerName</a> (sock, (uint8_t *)peer_ip, &amp;ip_len, &amp;peer_port);</div>
<div class="line">}</div>
</div><!-- fragment --> 
</div>
</div>
<a class="anchor" id="ga6d69360e9774937b7bdc03b45fbc9075"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t ARM_WIFI_SocketGetOpt </td>
          <td>(</td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>socket</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>opt_id</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>opt_val</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t *&#160;</td>
          <td class="paramname"><em>opt_len</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get socket option. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">socket</td><td>Socket identification number </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">opt_id</td><td>Option identifier </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">opt_val</td><td>Pointer to the buffer that will receive the option value </td></tr>
    <tr><td class="paramdir">[in,out]</td><td class="paramname">opt_len</td><td>Pointer to length of the option value<ul>
<li>length of buffer on input</li>
<li>length of data on output </li>
</ul>
</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>status information<ul>
<li>0 : Operation successful</li>
<li><a class="el" href="group__wifi__soc__func.html#ga535e069b83aafcf70dd089e6097bceef">ARM_SOCKET_ESOCK</a> : Invalid socket</li>
<li><a class="el" href="group__wifi__soc__func.html#ga695aa5c5329602d9465fbc6c22fc9978">ARM_SOCKET_EINVAL</a> : Invalid argument</li>
<li><a class="el" href="group__wifi__soc__func.html#ga95ab80319bfbc5413fc5334e3d5ce5d2">ARM_SOCKET_ENOTSUP</a> : Operation not supported</li>
<li><a class="el" href="group__wifi__soc__func.html#ga2f3db9fdae2366238054ff8a8e8ef97c">ARM_SOCKET_ERROR</a> : Unspecified error</li>
</ul>
</dd></dl>
<p>The function <b>ARM_WIFI_SocketGetOpt</b> retrieves options for a socket.</p>
<p>The argument <em>socket</em> specifies a socket identification number returned from a previous call to <a class="el" href="group__wifi__socket__gr.html#ga1433b297315ab394f1544a18548ffcc6">ARM_WIFI_SocketCreate</a>.</p>
<p>The argument <em>opt_id</em> is the socket option for which the value is to be retrieved. The following socket options are supported: </p>
<table class="doxtable">
<tr>
<th align="left">Option </th><th align="left">Description  </th></tr>
<tr>
<td align="left"><a class="el" href="group__wifi__soc__opt.html#ga6f76374467b5580ab0e440da1c39024e">ARM_SOCKET_SO_RCVTIMEO</a> </td><td align="left">Timeout for receiving in blocking mode </td></tr>
<tr>
<td align="left"><a class="el" href="group__wifi__soc__opt.html#gad633987fb5b3478b54d3269b1b03497a">ARM_SOCKET_SO_SNDTIMEO</a> </td><td align="left">Timeout for sending in blocking mode </td></tr>
<tr>
<td align="left"><a class="el" href="group__wifi__soc__opt.html#ga925f699a931ccbfb87eb5f3d36cbe405">ARM_SOCKET_SO_KEEPALIVE</a> </td><td align="left">Keep-alive mode for the stream socket </td></tr>
<tr>
<td align="left"><a class="el" href="group__wifi__soc__opt.html#ga0466a14ce32b2cc28887735b632f3e63">ARM_SOCKET_SO_TYPE</a> </td><td align="left">Type of the socket (stream or datagram) </td></tr>
</table>
<p>The argument <em>opt_val</em> points to the buffer that will receive the value of the <em>opt_id</em>.</p>
<p>The argument <em>opt_len</em> contains the length of the buffer at the input and returns the length of the option information on the output.</p>
<p><b>Example:</b> </p>
<div class="fragment"><div class="line">uint32_t type;</div>
<div class="line"> </div>
<div class="line">wifi-&gt;<a class="code" href="group__wifi__interface__gr.html#a4771324fb6f39fb2837e98d9f0ed48ed">SocketGetOpt</a> (sock, <a class="code" href="group__wifi__soc__opt.html#ga0466a14ce32b2cc28887735b632f3e63">ARM_SOCKET_SO_TYPE</a>, &amp;type, <span class="keyword">sizeof</span>(type));</div>
<div class="line"><span class="keywordflow">if</span> (type == <a class="code" href="group__wifi__socket__type.html#ga9567d5735856190b2ae9cc39f68637f1">ARM_SOCKET_SOCK_STREAM</a>) {</div>
<div class="line">  <span class="comment">// Stream socket</span></div>
<div class="line">}</div>
<div class="line"><span class="keywordflow">if</span> (type == <a class="code" href="group__wifi__socket__type.html#gaced5f33eda2fc38a8303cd11a0d76fab">ARM_SOCKET_SOCK_DGRAM</a>) {</div>
<div class="line">  <span class="comment">// Datagram socket</span></div>
<div class="line">}</div>
</div><!-- fragment --> 
</div>
</div>
<a class="anchor" id="ga5de80d6729d9504a21dd5d31dc504017"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t ARM_WIFI_SocketSetOpt </td>
          <td>(</td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>socket</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>opt_id</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const void *&#160;</td>
          <td class="paramname"><em>opt_val</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>opt_len</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set socket option. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">socket</td><td>Socket identification number </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">opt_id</td><td>Option identifier </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">opt_val</td><td>Pointer to the option value </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">opt_len</td><td>Length of the option value in bytes </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>status information<ul>
<li>0 : Operation successful</li>
<li><a class="el" href="group__wifi__soc__func.html#ga535e069b83aafcf70dd089e6097bceef">ARM_SOCKET_ESOCK</a> : Invalid socket</li>
<li><a class="el" href="group__wifi__soc__func.html#ga695aa5c5329602d9465fbc6c22fc9978">ARM_SOCKET_EINVAL</a> : Invalid argument</li>
<li><a class="el" href="group__wifi__soc__func.html#ga95ab80319bfbc5413fc5334e3d5ce5d2">ARM_SOCKET_ENOTSUP</a> : Operation not supported</li>
<li><a class="el" href="group__wifi__soc__func.html#ga2f3db9fdae2366238054ff8a8e8ef97c">ARM_SOCKET_ERROR</a> : Unspecified error</li>
</ul>
</dd></dl>
<p>The function <b>ARM_WIFI_SocketSetOpt</b> sets options for a socket.</p>
<p>The argument <em>socket</em> specifies a socket identification number returned from a previous call to <a class="el" href="group__wifi__socket__gr.html#ga1433b297315ab394f1544a18548ffcc6">ARM_WIFI_SocketCreate</a>.</p>
<p>The argument <em>opt_id</em> is the socket option for which the value is to be set. The following socket options are supported: </p>
<table class="doxtable">
<tr>
<th align="left">Option </th><th align="left">Description  </th></tr>
<tr>
<td align="left"><a class="el" href="group__wifi__soc__opt.html#gac6fa12bbc640209a6b63f8cec282f961">ARM_SOCKET_IO_FIONBIO</a> </td><td align="left">Non-blocking mode for the socket </td></tr>
<tr>
<td align="left"><a class="el" href="group__wifi__soc__opt.html#ga6f76374467b5580ab0e440da1c39024e">ARM_SOCKET_SO_RCVTIMEO</a> </td><td align="left">Timeout for receiving in blocking mode </td></tr>
<tr>
<td align="left"><a class="el" href="group__wifi__soc__opt.html#gad633987fb5b3478b54d3269b1b03497a">ARM_SOCKET_SO_SNDTIMEO</a> </td><td align="left">Timeout for sending in blocking mode </td></tr>
<tr>
<td align="left"><a class="el" href="group__wifi__soc__opt.html#ga925f699a931ccbfb87eb5f3d36cbe405">ARM_SOCKET_SO_KEEPALIVE</a> </td><td align="left">Keep-alive mode for the stream socket </td></tr>
</table>
<p>The argument <em>opt_val</em> points to the buffer containing the value of the <em>opt_id</em>.</p>
<p>The argument <em>opt_len</em> tells the exact length of the option.</p>
<p><b>Example:</b> </p>
<div class="fragment"><div class="line">uint32_t nonblocking = 0U;    <span class="comment">// Blocking mode</span></div>
<div class="line">uint32_t timeout = 10000U;    <span class="comment">// Timeout 10 seconds</span></div>
<div class="line"> </div>
<div class="line">wifi-&gt;<a class="code" href="group__wifi__interface__gr.html#a7019060d0869a7dfae8e31aedb46815d">SocketSetOpt</a> (sock, <a class="code" href="group__wifi__soc__opt.html#gac6fa12bbc640209a6b63f8cec282f961">ARM_SOCKET_IO_FIONBIO</a>, &amp;nonblocking, <span class="keyword">sizeof</span>(nonblocking));</div>
<div class="line">wifi-&gt;<a class="code" href="group__wifi__interface__gr.html#a7019060d0869a7dfae8e31aedb46815d">SocketSetOpt</a> (sock, <a class="code" href="group__wifi__soc__opt.html#ga6f76374467b5580ab0e440da1c39024e">ARM_SOCKET_SO_RCVTIMEO</a>, &amp;timeout, <span class="keyword">sizeof</span>(timeout)); </div>
<div class="line">wifi-&gt;<a class="code" href="group__wifi__interface__gr.html#a7019060d0869a7dfae8e31aedb46815d">SocketSetOpt</a> (sock, <a class="code" href="group__wifi__soc__opt.html#gad633987fb5b3478b54d3269b1b03497a">ARM_SOCKET_SO_SNDTIMEO</a>, &amp;timeout, <span class="keyword">sizeof</span>(timeout));</div>
</div><!-- fragment --> 
</div>
</div>
<a class="anchor" id="ga391464de71b6a5d300fda9434fe87a87"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t ARM_WIFI_SocketClose </td>
          <td>(</td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>socket</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Close and release a socket. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">socket</td><td>Socket identification number </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>status information<ul>
<li>0 : Operation successful</li>
<li><a class="el" href="group__wifi__soc__func.html#ga535e069b83aafcf70dd089e6097bceef">ARM_SOCKET_ESOCK</a> : Invalid socket</li>
<li><a class="el" href="group__wifi__soc__func.html#ga699dbd55e543fd38d333cf1d4470d8db">ARM_SOCKET_EAGAIN</a> : Operation would block (may be called again)</li>
<li><a class="el" href="group__wifi__soc__func.html#ga2f3db9fdae2366238054ff8a8e8ef97c">ARM_SOCKET_ERROR</a> : Unspecified error</li>
</ul>
</dd></dl>
<p>The function <b>ARM_WIFI_SocketClose</b> closes an existing socket and releases the socket descriptor. Further references to <em>socket</em> fail with <code>ARM_SOCKET_EINVAL</code> error code.</p>
<p>The argument <em>socket</em> specifies a socket identification number returned from a previous call to <a class="el" href="group__wifi__socket__gr.html#ga1433b297315ab394f1544a18548ffcc6">ARM_WIFI_SocketCreate</a>.</p>
<p>In blocking mode, which is enabled by default, this function will wait until a socket is closed. In non blocking mode, you must call the <b>ARM_WIFI_SocketClose</b> function again if the error code <code>ARM_SOCKET_EAGAIN</code> is returned.</p>
<p><b>Example:</b> </p>
<ul>
<li>see <a class="el" href="group__wifi__socket__gr.html#ga4929aab257781dcaae7197f917991779">ARM_WIFI_SocketListen</a> </li>
</ul>

</div>
</div>
<a class="anchor" id="ga0c37435c6abc68ee0f1f4357b503e0bf"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t ARM_WIFI_SocketGetHostByName </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int32_t&#160;</td>
          <td class="paramname"><em>af</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>ip</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t *&#160;</td>
          <td class="paramname"><em>ip_len</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Retrieve host IP address from host name. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">name</td><td>Host name </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">af</td><td>Address family </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">ip</td><td>Pointer to buffer where resolved IP address shall be returned </td></tr>
    <tr><td class="paramdir">[in,out]</td><td class="paramname">ip_len</td><td>Pointer to length of 'ip'<ul>
<li>length of supplied 'ip' on input</li>
<li>length of stored 'ip' on output </li>
</ul>
</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>status information<ul>
<li>0 : Operation successful</li>
<li><a class="el" href="group__wifi__soc__func.html#ga695aa5c5329602d9465fbc6c22fc9978">ARM_SOCKET_EINVAL</a> : Invalid argument</li>
<li><a class="el" href="group__wifi__soc__func.html#ga95ab80319bfbc5413fc5334e3d5ce5d2">ARM_SOCKET_ENOTSUP</a> : Operation not supported</li>
<li><a class="el" href="group__wifi__soc__func.html#ga320ffeeb44d583c0216b24d6e1009d9f">ARM_SOCKET_ETIMEDOUT</a> : Operation timed out</li>
<li><a class="el" href="group__wifi__soc__func.html#ga4d5d38e9a7d5907a3de4165476640cd4">ARM_SOCKET_EHOSTNOTFOUND</a> : Host not found</li>
<li><a class="el" href="group__wifi__soc__func.html#ga2f3db9fdae2366238054ff8a8e8ef97c">ARM_SOCKET_ERROR</a> : Unspecified error</li>
</ul>
</dd></dl>
<p>The function <b>ARM_WIFI_SocketGetHostByName</b> retrieves host information corresponding to a host name from a host database. It does this by sending DNS requests to the DNS server. The IP address of the DNS server is specified in the network interface configuration or can be obtained from the DHCP server for the local area network.</p>
<p>The argument <em>name</em> is a pointer to the <span class="XML-Token">null</span>-terminated name of the host to resolve.</p>
<p>The argument <em>af</em> specifies the address family, that is, which type of IP address you want to resolve. The following values are supported: </p>
<table class="doxtable">
<tr>
<th align="left">Family </th><th align="left">Description  </th></tr>
<tr>
<td align="left"><a class="el" href="group__wifi__addr__family.html#ga1a17023d92374b4f2d963aa7ac1c4e17">ARM_SOCKET_AF_INET</a> </td><td align="left">Resolve the IPv4 address </td></tr>
<tr>
<td align="left"><a class="el" href="group__wifi__addr__family.html#gad50c95421ffbc6eec5f8458b2e170c26">ARM_SOCKET_AF_INET6</a> </td><td align="left">Resolve the IPv6 address </td></tr>
</table>
<p>The argument <em>ip</em> is a pointer to the buffer that will receive the resolved IP address of the host. If the argument <em>ip</em> is <span class="XML-Token">NULL</span>, the function returns error.</p>
<p>The argument <em>ip_len</em> is a pointer to the IP address length. It should initially contain the amount of space pointed to by <em>ip</em>. On return it contains the actual length of the address returned in bytes.</p>
<p><b>Example:</b> </p>
<div class="fragment"><div class="line"><span class="keyword">extern</span> <a class="code" href="group__wifi__interface__gr.html#structARM__DRIVER__WIFI">ARM_DRIVER_WIFI</a> Driver_WiFi0;</div>
<div class="line"><span class="keyword">static</span> <a class="code" href="group__wifi__interface__gr.html#structARM__DRIVER__WIFI">ARM_DRIVER_WIFI</a> *wifi;</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> ping_arm_com (<span class="keywordtype">void</span>) {</div>
<div class="line">  uint8_t ip[4];</div>
<div class="line">  uint32_t ip_len;</div>
<div class="line">  int32_t res;</div>
<div class="line"> </div>
<div class="line">  wifi = &amp;Driver_WiFi0;</div>
<div class="line">  ip_len = <span class="keyword">sizeof</span>(ip);</div>
<div class="line">  res = wifi-&gt;<a class="code" href="group__wifi__interface__gr.html#a62b2512cbaef03d26eb9c1e3004c3364">SocketGetHostByName</a> (<span class="stringliteral">&quot;www.arm.com&quot;</span>, <a class="code" href="group__wifi__addr__family.html#ga1a17023d92374b4f2d963aa7ac1c4e17">ARM_SOCKET_AF_INET</a>, (uint8_t *)ip, &amp;ip_len);</div>
<div class="line">  <span class="keywordflow">if</span> (res == <a class="code" href="group__execution__status.html#ga85752c5de59e8adeb001e35ff5be6be7">ARM_DRIVER_OK</a>) {</div>
<div class="line">    res = wifi-&gt;<a class="code" href="group__wifi__interface__gr.html#ad8f218e434e2f327335b16cdb4f21f65">Ping</a> ((uint8_t *)ip, <span class="keyword">sizeof</span>(ip));</div>
<div class="line">    <span class="keywordflow">if</span> (res == <a class="code" href="group__execution__status.html#ga85752c5de59e8adeb001e35ff5be6be7">ARM_DRIVER_OK</a>) {</div>
<div class="line">      <span class="comment">// &quot;www.arm.com&quot; responded to ping  </span></div>
<div class="line">    }</div>
<div class="line">  }</div>
<div class="line">  <span class="keywordflow">else</span> {</div>
<div class="line">    <span class="comment">// &quot;www.arm.com&quot; not resolved</span></div>
<div class="line">  }</div>
<div class="line">}</div>
</div><!-- fragment --> 
</div>
</div>
<a class="anchor" id="gac7a8abb9e23f3f52dabce4153a53c1ca"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int32_t ARM_WIFI_Ping </td>
          <td>(</td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>ip</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>ip_len</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Probe remote host with Ping command. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">ip</td><td>Pointer to remote host IP address </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">ip_len</td><td>Length of 'ip' address in bytes </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>execution status<ul>
<li><a class="el" href="group__execution__status.html#ga85752c5de59e8adeb001e35ff5be6be7">ARM_DRIVER_OK</a> : Operation successful</li>
<li><a class="el" href="group__execution__status.html#ga2f627075447749bb368d3b768be107cb">ARM_DRIVER_ERROR</a> : Operation failed</li>
<li><a class="el" href="group__execution__status.html#ga0bac892205bb2d586b822e8b178ab310">ARM_DRIVER_ERROR_TIMEOUT</a> : Timeout occurred</li>
<li><a class="el" href="group__execution__status.html#ga2efa59e480d82697795439220e6884e4">ARM_DRIVER_ERROR_UNSUPPORTED</a> : Operation not supported</li>
<li><a class="el" href="group__execution__status.html#gac781d4b70ce17c4c2efe2db045be751c">ARM_DRIVER_ERROR_PARAMETER</a> : Parameter error (NULL ip pointer or ip_len different than 4 or 16)</li>
</ul>
</dd></dl>
<p>The function <b>ARM_WIFI_Ping</b> checks if the remote host is reachable. It does this by sending an echo request and waiting for an echo response. The function then returns the result of the operation. Check the <a class="el" href="group__wifi__control__gr.html#structARM__WIFI__CAPABILITIES">ARM_WIFI_CAPABILITIES</a> of the driver, if this function is supported in the driver implementation.</p>
<p>The argument <em>ip</em> is a pointer to the buffer containing the IP address octets of the host to ping.</p>
<p>The argument <em>ip_len</em> specifies the length of the IP address. The length is <span class="XML-Token">4</span> bytes for the IPv4 address and <span class="XML-Token">16</span> bytes for the IPv6 address.</p>
<dl class="section note"><dt>Note</dt><dd>The host availability check fails, if the remote host does not respond to echo requests, or intermediate routers do not forward the echo requests or echo responses.</dd></dl>
<p><b>Example:</b> </p>
<div class="fragment"><div class="line"><span class="keyword">extern</span> <a class="code" href="group__wifi__interface__gr.html#structARM__DRIVER__WIFI">ARM_DRIVER_WIFI</a> Driver_WiFi0;</div>
<div class="line"><span class="keyword">static</span> <a class="code" href="group__wifi__interface__gr.html#structARM__DRIVER__WIFI">ARM_DRIVER_WIFI</a> *wifi;</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">void</span> ping_host (<span class="keywordtype">void</span>) {</div>
<div class="line">  uint8_t ip[4] = { 192U, 168U, 0U, 100U };</div>
<div class="line">  int32_t res;</div>
<div class="line"> </div>
<div class="line">  wifi = &amp;Driver_WiFi0;</div>
<div class="line">  res = wifi-&gt;<a class="code" href="group__wifi__interface__gr.html#ad8f218e434e2f327335b16cdb4f21f65">Ping</a> ((uint8_t *)ip, <span class="keyword">sizeof</span>(ip));</div>
<div class="line">  <span class="keywordflow">if</span> (res == <a class="code" href="group__execution__status.html#ga85752c5de59e8adeb001e35ff5be6be7">ARM_DRIVER_OK</a>) {</div>
<div class="line">    <span class="comment">// Host responded</span></div>
<div class="line">  }</div>
<div class="line">}</div>
</div><!-- fragment --> 
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">
      <script type="text/javascript">
        <!--
        writeFooter.call(this);
        //-->
      </script>    
    </li>
  </ul>
</div>
</body>
</html>
